import 'package:flutter/material.dart';
import 'package:example/index.dart';

import '../logic.dart';

class FoundItem extends GetView<FoundPageLogic> {
  final String title;
  final String subtitle;
  final String rightImageUrl;
  final Function() onTap;

  const FoundItem({
    Key? key,
    required this.title,
    required this.subtitle,
    required this.rightImageUrl,
    required this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(horizontal: 15.dp, vertical: 5.dp),
      child: Card(
        elevation: 8.dp,
        shape:
            RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.dp)),
        child: Ink(
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(15.dp),
            gradient: LinearGradient(
                colors: controller.getColorList(),
                begin: Alignment.topLeft,
                end: Alignment.bottomRight),
          ),
          child: InkWell(
            splashColor: Colors.grey[300],
            borderRadius: BorderRadius.circular(15.dp),
            onTap: () => onTap,
            child: Container(
              width: Get.infinity,
              padding: EdgeInsets.all(10.dp),
              child: Row(
                children: [
                  Expanded(
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Text(
                          title,
                          style: TextStyle(
                              color: Colors.white,
                              fontSize: 18.sp,
                              fontWeight: FontWeight.bold),
                        ),
                        Get.heightBox(8.dp),
                        Text(
                          subtitle,
                          style: TextStyle(
                            color: Colors.white,
                            fontSize: 14.sp,
                          ),
                        ),
                      ],
                    ),
                  ),
                  Get.widthBox(10.dp),
                  ImageView.assets(
                      path: rightImageUrl,
                      fit: BoxFit.fill,
                      width: 30.dp,
                      height: 30.dp),
                  Get.widthBox(10.dp),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
